﻿<%@ Page Language="C#" Title="Quản lý lượt xe đi/về" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ManageTimeTable.aspx.cs" Inherits="View_ManageTimeTable" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">

            //enter search
            function OnKeyPress(sender, eventArgs) {
                var c = eventArgs.get_keyCode();
                if (c == 13) {
                    var stringSearch = $("#<%= txtKeyWord.ClientID%>").val();
                    $("#<%= hdfSearchString.ClientID %>").val(stringSearch);
                    $("#<%=btnSearch.ClientID %>").click();
                    eventArgs.set_cancel(true);
                }
            }

            function messsage(mes) {
                alert(mes);
                return false;
            }


        </script>
    </telerik:RadScriptBlock>
    <link href="../Style/StyleCommon.css" rel="stylesheet" type="text/css" />
    <link href="../Style/StyleCommon.css" rel="stylesheet" />
    <script language="javascript" type="text/javascript" src="../Scripts/Common.js"> </script>
    <div class="tabHeader">
        <span class="iconHomeBox">
            <img src="../Content/system/timetable.png" style="width: 30px; height: 30px; position: absolute" title="Quản lý lượt xe đi về" />
            <div class="tabHeaderText" style="padding-top: 5px; padding-left: 40px;">
                <asp:Label ID="Label1" runat="server" Text="Quản lý lượt xe đi/về" />
            </div>
    </div>
    <div id="tab1" class="tabContent tabDetailContent">
        <telerik:RadAjaxPanel ID="rapTimeTable" runat="server" LoadingPanelID="loadingPanel"
            HorizontalAlign="NotSet">
            <asp:HiddenField runat="server" ID="hdfSearchString" />
            <div id="message">
            </div>
            <table style="width: 100%">
                <tr style="text-align: left">
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <telerik:RadTextBox ID="txtKeyWord" runat="server" Height="25px" EmptyMessage="Nhập từ khóa tìm kiếm" LabelCssClass="" Width="200px">
                                        <ClientEvents OnKeyPress="OnKeyPress" />
                                    </telerik:RadTextBox>
                                </td>
                                <td>
                                    <asp:Button ID="btnSearch" runat="server" CssClass="myButton"  Text="Tìm kiếm"
                                        OnClick="btnSearch_Click" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <telerik:RadGrid ID="rdGTimeTable" MasterTableView-InsertItemPageIndexAction="ShowItemOnFirstPage" runat="server" AllowPaging="True" AutoGenerateColumns="False" GridLines="None" OnDeleteCommand="rdGTimeTable_DeleteCommand" OnInsertCommand="rdGTimeTable_InsertCommand" OnItemDataBound="rdGTimeTable_ItemDataBound" OnNeedDataSource="rdGTimeTable_NeedDataSource" OnUpdateCommand="rdGTimeTable_UpdateCommand" PageSize="5" Skin="Office2010Blue">
                <ClientSettings EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
                <MasterTableView AllowSorting="True" CommandItemDisplay="Top" DataKeyNames="IDTimeTable">
                    <Columns>
                        <telerik:GridTemplateColumn DataField="STT" HeaderText="STT" UniqueName="STT">
                            <ItemTemplate>
                                <asp:Label ID="lblSTT" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="NameBusTrip" EditFormHeaderTextFormat="Chuyến xe:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Chuyến xe" UniqueName="NameBusTrip">
                            <EditItemTemplate>
                                <telerik:RadComboBox Filter="Contains" ID="ddlNameBusTrip" runat="server" AutoPostBack="true"
                                    Skin="Office2010Blue" Width="300px">
                                </telerik:RadComboBox>
                                <asp:Label ID="lblBusTripID" runat="server" Text='<%# Bind("IDBusTrip") %>' Visible="false"></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNameBusTrip" Font-Bold="false" runat="server" Text='<%# Eval("NameBusTrip") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="NameStation" EditFormHeaderTextFormat="Tuyến xe:" HeaderText="Tuyến xe" UniqueName="NameStation">
                            <ItemTemplate>
                                <asp:Label ID="lblNameStation" runat="server" Text='<%# Eval("NameStation") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="RegistrationNumber" EditFormHeaderTextFormat="Biển kiểm soát:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Biển kiểm soát" UniqueName="RegistrationNumber">
                            <EditItemTemplate>
                                <telerik:RadComboBox Filter="Contains" ID="ddlIDBus" runat="server" AutoPostBack="true"
                                    Skin="Office2010Blue" Width="300px">
                                </telerik:RadComboBox>
                                <asp:Label ID="lblIDBus" runat="server" Text='<%# Bind("IDBus") %>' Visible="false"></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblRegistrationNumber" runat="server" Text='<%# Eval("RegistrationNumber") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="FullName" EditFormHeaderTextFormat="Họ tên lái xe:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Họ tên lái xe" UniqueName="FullName">
                            <EditItemTemplate>
                                <telerik:RadComboBox Filter="Contains" ID="ddlIDDriver" runat="server" AutoPostBack="true"
                                    Skin="Office2010Blue" Width="300px">
                                </telerik:RadComboBox>
                                <asp:Label ID="lblIDDriver" runat="server" Text='<%# Bind("IDDrive") %>' Visible="false"></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblFullName" runat="server" Text='<%# Eval("FullName") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="TimeStart" EditFormHeaderTextFormat="Thời gian xuất bến:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Thời gian xuất bến" UniqueName="TimeStart">
                            <EditItemTemplate>
                                <telerik:RadDateTimePicker Skin="Office2010Blue" Width="305px" ID="rdTimeStart" runat="server" DbSelectedDate='<%# Bind("TimeStart") %>'>
                                    <Calendar ID="CalendarTimeStart" runat="server" EnableKeyboardNavigation="true">
                                    </Calendar>
                                    <DateInput ID="dateInputStart" runat="server" DateFormat="yyyy-MM-dd hh:mm:ss" DisplayDateFormat="dd/MM/yyyy hh:mm" ToolTip="Date input"></DateInput>
                                    <TimeView runat="server" TimeFormat="HH:mm:ss">
                                    </TimeView>
                                </telerik:RadDateTimePicker>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblTimeStart" runat="server" Text='<%# Eval("TimeStart") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="TimeStopExpected" EditFormHeaderTextFormat="Thời gian về bến:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Thời gian về bến" UniqueName="TimeStopExpected">
                            <EditItemTemplate>
                                <telerik:RadDateTimePicker Skin="Office2010Blue" Width="305px" ID="rdTimeStop" runat="server" DbSelectedDate='<%# Bind("TimeStopExpected") %>'>
                                    <Calendar ID="CalendarTimeStopExpected" runat="server" EnableKeyboardNavigation="true">
                                    </Calendar>
                                    <DateInput ID="dateInputSTop" runat="server" DateFormat="yyyy-MM-dd hh:mm:ss" DisplayDateFormat="dd/MM/yyyy hh:mm" ToolTip="Date input"></DateInput>
                                    <TimeView ID="TimeView1" runat="server" TimeFormat="HH:mm:ss">
                                    </TimeView>
                                </telerik:RadDateTimePicker>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblTimeStopExpected" runat="server" Text='<%# Eval("TimeStopExpected") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Direction" EditFormHeaderTextFormat="Chiều xe:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Chiều xe" UniqueName="Direction">
                            <EditItemTemplate>
                                <telerik:RadComboBox Filter="Contains" ID="ddlDirection" runat="server" AutoPostBack="true"
                                    Skin="Office2010Blue" Width="300px">
                                </telerik:RadComboBox>
                                <asp:Label ID="lblIDDrirection" runat="server" Text='<%# Bind("Direction") %>' Visible="false"></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblDirection" runat="server" Text='<%# Eval("Direction") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="MONEY" EditFormHeaderTextFormat="Tiền vé thu được:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Tiền vé thu được" UniqueName="MONEY">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtMONEY" runat="server" Text='<%# Bind("MONEY") %>' Width="288px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblMONEY" runat="server" Text='<%# Eval("MONEY") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>

                        <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../Images/Grid/Skins/Telerik/Edit.gif" EditText="Chỉnh sửa" InsertImageUrl="../Images/Grid/Skins/Telerik/Insert.gif" ItemStyle-Height="20px" ItemStyle-Width="20px" UniqueName="Edit">
                            <ItemStyle CssClass="editcommand" />
                            <HeaderStyle Height="20px" HorizontalAlign="Left" Width="20px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Bạn có chắc chắn muốn xóa không?" ImageUrl="../Images/Grid/Skins/Telerik/Delete.gif" ItemStyle-Height="20px" ItemStyle-Width="20px" Text="Xóa" UniqueName="Delete">
                            <ItemStyle CssClass="editcommand" />
                            <HeaderStyle Height="20px" HorizontalAlign="Left" Width="20px" />
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings CaptionDataField="STT" CaptionFormatString="Chỉnh sửa dữ liệu cho STT {0}">
                        <EditColumn ButtonType="PushButton" CancelText="Hủy bỏ" InsertText="Thêm mới" UniqueName="EditCommandColumn1" UpdateText="Cập nhật">
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="True" CssClass="GridPager_Telerik" Mode="NextPrevNumericAndAdvanced" NextPageText="Next" PagerTextFormat="{4}|Displaying page {0} / {1},items {2} to {3} of {5}" PrevPageText="Previous" VerticalAlign="Middle" />
                    <CommandItemTemplate>
                        <table style="border: 0; width: 100%">
                            <tr>
                                <td style="text-align: left">
                                    <asp:LinkButton ID="lkbtnAddOrganizationInv" runat="server" CommandName="InitInsert" Text="&lt;img style=&quot;border:0px&quot; alt=&quot;&quot; src=&quot;../Images/Grid/Skins/Telerik/AddRecord.gif&quot; /&gt; Thêm mới"></asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>
                </MasterTableView>
            </telerik:RadGrid>
            <telerik:RadInputManager runat="server" ID="RadInputManager1">
                <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" EmptyMessage="Vui lòng nhập dữ liệu..." ErrorMessage="Vui lòng nhập dữ liệu.." Type="Number" DecimalDigits="0"
                    MinValue="0">
                    <TargetControls>
                        <telerik:TargetInput ControlID="txtMONEY" />
                    </TargetControls>
                </telerik:NumericTextBoxSetting>
            </telerik:RadInputManager>

        </telerik:RadAjaxPanel>

        <telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" Transparency="30" BackColor="White"
            Width="967px">
            <asp:Image ID="Image1" runat="server" Style="margin-top: 150px" AlternateText="Loading"
                BorderWidth="0px" ImageUrl="../Images/ImageControl/loading.old.gif" />
        </telerik:RadAjaxLoadingPanel>
    </div>
    </span>
</asp:Content>
